from sanic import Sanic
from sanic.response import text
import asyncio
import time
import threading

app = Sanic("MyHelloWorldApp")

print(threading.get_ident(), threading.get_native_id())


@app.get("/sync")
async def hello_world(request):
    print('start sync', threading.get_ident(), threading.get_native_id())
    time.sleep(10)  # third-party libraries
    return text("Hello, world.")


@app.get("/async")
async def hello_world2(request):
    await asyncio.sleep(10)
    return text("Hello, world.")
